<div class="form">

<script type="text/javascript" language="javascript">
	$(document).ready(function(){

	    var counter = 2;
		
	    $("#addNew").click(function () {
				
			if(counter>5){
		        alert("Only 5 textboxes allow");
		        return false;
		    } 

			var newTextBoxDiv = $(document.createElement('div')).attr("id", 'TextBoxDiv' + counter);
			console.log(newTextBoxDiv);
               newTextBoxDiv.html('<label>Skill Set '+ counter + ' : </label>' +
				'<input type="textField" name="ProjDetail[skill_set][' + counter + 
				']" id="ProjDetail_skill_set' + counter + '" value="" >');
				
			newTextBoxDiv.appendTo("#TextBoxesGroup");
				
		    counter++;
	    });

	    $("#remove").click(function () {
		    if(counter==1){
		        alert("No more textbox to remove");
		        return false;
		    }   
	        counter--;
			
	        $("#TextBoxDiv" + counter).remove();
			
		});
		
		$("#ProjDetail_skill_set").click(function () {
		
			var msg = '';
			for(i=1; i<counter; i++){
				msg += "\n Textbox #" + i + " : " + $('#textbox' + i).val();
			}
		   	alert(msg);
		});
		
  });
</script>

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'proj-detail-proj_det_form-form',
	'enableAjaxValidation'=>false,
	'enableClientValidation'=>true,
)); ?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php echo $form->errorSummary($model); ?>

	<div class="row">
		<?php echo $form->labelEx($model,'client_name'); ?>
		<?php echo $form->textField($model,'client_name'); ?>
		<?php echo $form->error($model,'client_name'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'project_title'); ?>
		<?php echo $form->textField($model,'project_title'); ?>
		<?php echo $form->error($model,'project_title'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'duration'); ?>
		<?php echo $form->textField($model,'duration'); ?>
		<b>Years</b>
		<?php echo $form->error($model,'duration'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'location_name'); ?>
		<?php echo $form->checkBoxList($model,'location_name',ApplicationConfig::app()->params['vendor_params']['projLocation'], array('size'=>1,'maxlength'=>1)); ?>
		<?php echo $form->error($model,'location_name'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'employment_type'); ?>
		<?php echo $form->dropDownList($model,'employment_type',ApplicationConfig::app()->params['vendor_params']['empProjType'],array('empty' => 'Select Type')); ?>
		<?php //echo $form->dropDownList($model,'employment_type',ApplicationConfig::app()->params['scaling_params']['empProjType'],array('empty' => 'Select Type','multiple'=>'multiple')); ?>
		<?php echo $form->error($model,'employment_type'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'project_detail'); ?>
		<?php echo $form->textField($model,'project_detail'); ?>
		<?php echo $form->error($model,'project_detail'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'role'); ?>
		<?php echo $form->dropDownList($model,'role',ApplicationConfig::app()->params['vendor_params']['projRole'],array('empty' => 'Select Type')); ?>
		<?php echo $form->error($model,'role'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'role_description'); ?>
		<?php echo $form->textField($model,'role_description'); ?>
		<?php echo $form->error($model,'role_description'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'team_size'); ?>
		<?php echo $form->textField($model,'team_size'); ?>
		<?php echo $form->error($model,'team_size'); ?>
	</div>

	<div id='TextBoxesGroup'>
		<div class="row" id="TextBoxDiv1">
			<?php echo $form->labelEx($model,'skill_set'); ?>
			<?php echo $form->textField($model,'skill_set',array('name'=>'ProjDetail[skill_set][1]')); ?>
			<b><a id="addNew" href="#">Add</a></b>
			<b><a id="remove" href="#">Remove</a></b>
			<?php echo $form->error($model,'skill_set'); ?>
		</div>
	</div>

	<div class="row buttons">
		<?php echo CHtml::submitButton('Submit'); ?>
		<?php echo CHtml::link('Skip',ApplicationConfig::getURL("", "site", "index"),array()); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->